function Ajax(type, url, data) {
	var xhr = null;
	if(window.XMLHttpRequest){
		xhr = new XMLHttpRequest()
	}else{
		xhr = new ActiveXObject('Microsoft.XMLHTTP');
	}

	if(type == 'GET'){
		if(data){
			xhr.open('GET',url+'?'+data,true);
		}else{
			xhr.open('GET', url, true);
		}
		xhr.send();
	}else{
		xhr.open('POST', url, true);
		xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');
		xhr.send(data);
	}
	return new Promise(function(resolve, reject){
		xhr.onreadystatechange = function(){
			if(xhr.readyState == 4 && xhr.status == 200){
				resolve(xhr.responseText);
			}
		}
	})
}